import { reactive,onBeforeMount,onBeforeUnmount } from "vue";

export default function(){
    let mousePoint=reactive({
        X:0,
        Y:0
    })
    function savePoint(event:any){
      mousePoint.X=event.pageX,
      mousePoint.Y=event.pageY
      console.log(mousePoint.X,mousePoint.Y);
    }
    onBeforeMount(()=>{
      window.addEventListener('click',savePoint)
    })
    onBeforeUnmount(()=>{
      window.removeEventListener('click',savePoint)
    })
    return mousePoint
}